{extend name="base"/}
{block name="title"}
全部产品
{/block}
{block name="css"}
<link rel="stylesheet" href="__MOBILE__/css/wy.css">
<style>
    body{height: 100%;}
    .scrolltab-content{height: 92.6%;padding:.05rem 0 .2rem 0; margin-left: 0rem;width: 100%;}
    .scrolltab-nav{height: 91.9%;}
    .aui-flex-links{padding: 0rem;margin-top:1rem;border-radius:0rem;width: auto; margin-bottom: 1rem;}
    .now_value{float: left; margin-left: 0.1rem; margin-top: .3rem;}
    .shop_tops a{display: inline-block; width: 100%;height: 100%;}
    .rage{float:unset;}
    .bot_bot {float: right;width: 30%;height: 0.49rem;margin-top: -.9rem;}
</style>
{/block}
{block name="content"}
<!-- 头部 -->
<div class="head">
    <div class="head_left"><a href="javascript:history.go(-1)"><img src="__MOBILE__/images/true.png" alt=""></a></div>
    <div class="head_con">全部产品</div>
    <div class="head_right"><a href="{:url('/langjinmobile/Merchant/showAdd')}">上传</a></div>
</div>

<ul class="shop_tops">
    <li class="tops_the">在线产品</li>
    <li>下架商品</li>
</ul>
<div class="con_shops" style="display:block;">
    <section class="aui-flexView">
        <section class="aui-scrollView">
            <div class="m-scrolltab" data-ydui-scrolltab="">
                <div class="scrolltab-content">
                    <div class="scrolltab-content-item">
                        <!--<h2>{:lang('女装套装')}</h2>-->
                        <div>
                            <div class="aui-flex-links">
                                {foreach $is_showing as $goods}
                                <div class="list_t">
                                    <img src="{$goods.img1}" alt="">
                                    <h4>{$goods.name}</h4>
                                    <p class="now_value">  
                                        <i>￥</i><b class="qu_su">{$goods.wallet_num}</b> 
                                        <i>￥</i><b class="qu_su">{$goods.integral_num}</b> 
                                        <span class="rage">{:lang('库存')}{$goods.amount}</span>
                                    </p>
                                    <div class="clear"></div>
                                    <div class="bot_bot">
                                        <p class="ves"><img src="__MOBILE__/images/top_jia_1.png" onclick="check_is_on({$goods.id}, {$goods.status})" alt="{:lang('下架')}"></p>
                                        <p class="ves"><a href="{:url('show_edit',['id'=>$goods.id])}"><img src="__MOBILE__/images/xiazai.png" alt="{:lang('编辑')}"></a></p>
                                    </div>
                                </div>
                                {/foreach}
                                
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </section>
</div>
<div class="con_shops" style="display:none;">
    <section class="aui-flexView">
        <section class="aui-scrollView">
            <div class="m-scrolltab" data-ydui-scrolltab="">
                <div class="scrolltab-content">
                    <div class="scrolltab-content-item">
                        <!--<h2>{:lang('女装套装')}</h2>-->
                        <div>
                            <div class="aui-flex-links">
                                {foreach $is_down as $goods}
                                <div class="list_t">
                                    <img src="{$goods.img1}" alt="">
                                    <h4>{$goods.name}</h4>
                                    <p class="now_value">  
                                        <i>GMOB</i><b class="qu_su">{$goods.wallet_num}</b> 
                                        <i>GMOD</i><b class="qu_su">{$goods.integral_num}</b> 
                                        <span class="rage">{:lang('库存')}{$goods.amount}</span>
                                    </p>
                                    <div class="clear"></div>
                                    <div class="bot_bot">
                                        <p class="ves"><img src="__MOBILE__/images/shang_jia_1.png" onclick="check_is_on({$goods.id},{$goods.status})" alt="{:lang('上架')}"></p>
                                        <p class="ves"><a href="{:url('show_edit',['id'=>$goods.id])}"><img src="__MOBILE__/images/xiazai.png" alt="{:lang('编辑')}"></a></p>
                                    </div>
                                </div>
                                {/foreach}                                
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </section>
</div>


<div class="hui"></div>
<!-- <div class="shelves"><a href="{:url('/shop/business/add_goods')}">上架新产品</a></div> -->
<div class="t_pop">
    <p>确定下架该商品么？</p>
    <div class="but_to">
        <button class="qu_qu" style="box-sizing: border-box;border-right:.02rem solid #ebebeb;">取消</button>
        <button class="ok_ok" style="color: #fff; background: #ff900d;">确定</button>
    </div>
</div>

{/block}
{block name="js"}

<script>
     $(".shop_tops li").click(function(){
        var Oindex = $(this).index();
        $(".shop_tops li ").removeClass("tops_the").eq(Oindex).addClass("tops_the");
        $(".con_shops").hide().eq(Oindex).show();
    });


         //下架、上架商品
    function check_is_on(id,status){
        var str = '';
        if(status ==1){
            str = '下架';
        }else{
            str = '上架';
        }
        layer.confirm("确定要"+str+"商品吗？", {icon: 3, title:'提示'}, function(index){
            $.post('check_is_on',{'id':id},function(data){
                if(data.status == 1){
                    layer.msg(data.msg, {
                        time: 2000 //2秒关闭（如果不配置，默认是3秒）
                    }, function(){
                       location.reload();
                    });
                }else{
                    layer.msg(data.msg);
                }
            })

            layer.close(index);
        });

    }

        //下架、上架商品
    function edit(id,status){
        var str = '';
        if(status ==1){
            str = '下架';
        }else{
            str = '上架';
        }
        layer.confirm("确定要"+str+"商品吗？", {icon: 3, title:'提示'}, function(index){
            $.post('/shop/business/check_is_on',{'id':id},function(data){
                if(data.status == 1){
                    layer.msg(data.msg, {
                        time: 2000 //2秒关闭（如果不配置，默认是3秒）
                    }, function(){
                       location.reload();
                    });
                }else{
                    layer.msg(data.msg);
                }
            })

            layer.close(index);
        });

    }
</script>
{/block}